package com.mew.game.core.common.messge.response;

import com.mew.common.rest.bo.GameSession;
import com.zebra.common.ZebraBaseMessage;
import io.netty.buffer.ByteBuf;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;



@Data
@ToString(callSuper = true)
@NoArgsConstructor
public class EnterGameResponseMessage extends ZebraBaseMessage<EnterGameResponseMessage> {

    private UserMessage userMessage;
    //TODO 进入游戏信息


    @Override
    public void write(ByteBuf b) {

        userMessage.write(b);

    }

    @Override
    public EnterGameResponseMessage read(ByteBuf b) {
        this.userMessage = new UserMessage().read(b);
        return this;
    }


    public EnterGameResponseMessage buildData(GameSession slotsSession){
        this.userMessage = UserMessage.builder()
                .uid(slotsSession.getUserId())
                .gid(slotsSession.getGid())
                .headPath(slotsSession.getHeadPath())
                .nickname(slotsSession.getNickname())
                .build();
        return this;
    }

}





